#ifndef HOMING_H
#define HOMING_H
#include "stm32f4xx.h"
#include "HeaderFile.h"

/***********User Define Begin ***************/
#define 	HOME_MODE				3	
#define 	ZERO_TORQUE				200
#define 	ZERO_CURRENT			500


/************User Define End *****************/


/*********  User Extern Begin **************/


/*********  User Extern End **************/



/***************User-defined Variable Type Begin ********************/
typedef enum
{
	HOME_ING,
	HOME_BEGIN,
	HOME_OK
}Home_State_e;


/***************User-defined Variable Type End ********************/




/*****************User Function Void Begin***************/

void JMC_HomingTPDOConfig(void);
void JMC_HomingRPDOConfig(void);
uint8_t JMC_HomingPDO_Config(void);


uint8_t JMC_HomingParamSet(CANopen_Node_t *posNode,Whole_PosMoto_t *pmoto, uint8_t homingMode, uint32_t homingMachineSpeed,int32_t homingSpeed, uint16_t homingAcc, int32_t homingOffset);

void HomingMode(uint8_t (*Homing_PDO_config)(void),PosTrialWorkPlace_t *posmoto_wp,CANopen_Node_t *posNode, Whole_PosMoto_t *pmoto,uint8_t homingMode, uint32_t homingMachineSpeed,int32_t homingSpeed, uint16_t homingAcc, int32_t homingOffset, uint8_t(*MOTO_TYPE_homingParamSet)(CANopen_Node_t *,Whole_PosMoto_t * ,uint8_t, uint32_t,int32_t, uint16_t, int32_t));


//***************** User Define Homing Mode Begin**********************//
uint8_t JMC_UserDefine_HomingPDO_Config(void);

uint8_t  JMC_UserDefine_HomingParamSet(CANopen_Node_t *posNode,Whole_PosMoto_t *pmoto, int32_t homingSpeed, uint16_t homingAcc, uint16_t homingDeacc);

void UserDefineHomingMode(uint8_t (*Homing_PDO_config)(void),PosTrialWorkPlace_t *posmoto_wp,CANopen_Node_t *posNode, Whole_PosMoto_t *pmoto, int32_t homingSpeed, uint16_t homingAcc, uint16_t homingDeacc, uint8_t(*MOTO_TYPE_UserDefine_homingParamSet)(CANopen_Node_t *, Whole_PosMoto_t *, int32_t, uint16_t, uint16_t));

void JMC_SpeedHoming_TPDO_DataStoreAndAnalysis(CANopen_Node_t *node ,Whole_PosMoto_t *pmoto, uint8_t *motodata_fb, uint8_t TPDO_num);
	
//***************** User Define Homing Mode End**********************//

/*****************User Function Void End***************/




#endif



